package com.juc.exchanger.exchanger2;

import java.util.concurrent.Exchanger;

public class ThreadA extends Thread{
	/**
	 * 传递数据
	 */
	private Exchanger<String> exchanger;
	public ThreadA(Exchanger<String> exchanger) {
		super();
		this.exchanger =exchanger;
	}
	
	@Override
	public void run() {
		try {
			System.out.println(" 在线程A中得到线程B的值 = " + exchanger.exchange(" 中国人A"));
		    System.out.println("A end！");
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
